import { ElMessageBox } from 'element-plus'
import { ref } from 'vue'

export default function () {
  const orderSelectList = ref<any[]>([])
  function addOrderSelect () {
    orderSelectList.value.push({
      field: [],
      orderType: 'ASC'
    })
  }
  function deleteOrderSelect (index: number) {
    ElMessageBox.confirm('确定要删除该条件吗？', '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      // 删除操作
      orderSelectList.value.splice(index, 1)
    })
  }
  return {
    orderSelectList,
    addOrderSelect,
    deleteOrderSelect
  }
}
